package com.xiaolin.exception;

import org.springframework.util.StringUtils;

/**
 * @ClassName MyRuntimeExceptionTest
 * @Description 描述
 * @Detail detail
 * @Author MyPC
 * @Date 2020/11/30
 * @Version 1.0
 */
public class MyRuntimeExceptionTest {
    public static void main(String[] args) {
        hello("");
    }

    /**
     * 抛出运行时异常，无需在方法处声明，项目中可以用SpringMVC的统一异常处理器进行处理
     * @param msg
     */
    public static void hello(String msg){
        if(StringUtils.isEmpty(msg)){
            throw new MyRuntimeException("空异常");
        }
    }
}
